package com.ruoyi.web.controller.hh;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.dto.ReportDataDto;
import com.ruoyi.service.IHhReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 统计报表Controller
 * @author chongjin
 * @date 2020-12-23
 */
@Controller
public class HhReportController extends BaseController {

    private String prefix = "hh/totalReport";

    @Autowired
    private IHhReportService hhReportService;

    /**
     * 获取师傅总览页面
     */
    @GetMapping("/totalReport/report")
    public String report() {
        return prefix + "/worker_report";
    }

    /**
     * 查询师傅总览报表
     */
    @PostMapping("/totalReport/report/workerReport")
    @ResponseBody
    public AjaxResult getWorkerReport(ReportDataDto reportDataDto) {
        return AjaxResult.success(hhReportService.getYearData(reportDataDto));
    }

    /**
     * 获取分类、月份报表页面
     */
    @GetMapping("/totalReport/report/typeMonth")
    public String typeReport() {
        return prefix + "/type_month";
    }

    /**
     * 获取分类、月份报表
     */
    @PostMapping("/totalReport/report/typeMonth")
    @ResponseBody
    public AjaxResult getTypeReport(ReportDataDto reportDataDto) {
        return AjaxResult.success(hhReportService.getTypeMonthReport(reportDataDto));
    }

    /**
     * 获取月份报表
     */
    @PostMapping("/totalReport/report/month")
    @ResponseBody
    public AjaxResult getMonthReport(ReportDataDto reportDataDto) {
        return AjaxResult.success(hhReportService.getMonthReport(reportDataDto));
    }

    /**
     * 获取师傅详情报表页面
     */
    @GetMapping("/totalReport/report/workerDetail")
    public String workerDetail() {
        return prefix + "/worker_detail";
    }

    /**
     * 查询师傅详情报表
     */
    @PostMapping("/totalReport/report/workerDetail")
    @ResponseBody
    public AjaxResult getWorkerDetailReport(ReportDataDto reportDataDto) {
        return AjaxResult.success(hhReportService.getWorkerDetailReport(reportDataDto));
    }

}
